<html>
<head>
    <meta charset="utf-8">
    <title>资料设置</title>
    <#assign base=request.contextPath  />
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="${base}/backstage/layui/css/layui.css" media="all">
    <script src="${base}/sweep/js/mui.min.js"></script>
    <script src="${base}/backstage/layui/layui.js"></script>
    <script src="${base}/backstage/js/jquery-1.8.3.min.js"></script>
    <script>
        var base =  "${base}";
    </script>
    <script src="${base}/backstage/js/ipNameUrl.js"></script>
</head>
<body>
<br>
<br>
<form class="layui-form " action="" style="padding-left: 15px;">
    <div class="layui-form-item">
        <label class="layui-form-label">账户</label>
        <div class="layui-input-block">
            <input class="layui-input" value="${userInfo.account}" name="account" id="account" placeholder="请输入账户" autocomplete="off">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">密码</label>
        <div class="layui-input-block">
            <input class="layui-input" value="${userInfo.passWord}" name="passWord" id="passWord" placeholder="请输入密码" autocomplete="off">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">手机号</label>
        <div class="layui-input-block">
            <input class="layui-input" value="${userInfo.phone}" name="phone" id="phone" placeholder="请输入手机号" autocomplete="off">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">地址</label>
        <div class="layui-input-block">
            <input class="layui-input" value="${userInfo.address}" name="address" id="address" placeholder="请输入地址" autocomplete="off">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">微信openid</label>
        <div class="layui-input-block">
            <input class="layui-input" disabled value="${userInfo.openid}" name="openid" id="openid" placeholder="请输入openid" autocomplete="off">
        </div>
    </div>

    <div class="layui-upload-drag" id="test10" style="position: relative;left:7%">
        <span>营业执照</span>
         <img src="${userInfo.url}"  style="max-width: 300px">
        <span>身份证正面</span>
         <img src="${userInfo.positive}"  style="max-width: 300px">
        <span>身份证反面</span>
         <img src="${userInfo.side}"  style="max-width: 300px">
    </div>


    <br>
    <br>
    <div align="center">
        <button type="button" class="layui-btn" id="saveButton">保存</button>
        <button type="button" class="layui-btn" onclick="window.history.back(-1);">返回</button>
    </div>
</form>
</body>
<script>
    layui.use(['form', 'layer', 'upload'], function () {
        var form = layui.form
            , layer = layui.layer
            , $ = layui.jquery
            , upload = layui.upload;
    })
    $("#saveButton").on("click", function () {


        if($("#account").val()==""){
            layer.msg("请填写账户！")
            return;
        }
        if($("#passWord").val()==""){
            layer.msg("请填写密码！")
            return;
        }
        if($("#phone").val()==""){
            layer.msg("请填写联系电话！")
            return;
        }
        if($("#address").val()==""){
            layer.msg("请填写地址！")
            return;
        }

        var formDate = {
            account: $("#account").val(),
            passWord: $("#passWord").val(),
            phone: $("#phone").val(),
            address: $("#address").val(),
            id: '${userInfo.id}'
        }

        $.ajax({
            type: "POST",
            contentType: "application/json;charset=UTF-8",
            url: "${base}/admin/userInfo/updateUserInfo",
            data: JSON.stringify(formDate),
            success: function (data) {
                if (data.code === 200) {
                    layer.msg(data.msg)
                    window.open("${base}/admin/index/login.html")

                } else {
                    layer.msg(data.msg)
                }
            }
        });
    })
</script>
</html>


